/**************************************************************
    Problem: 1834
    User: DragoonKiller
    Language: C++
    Result: Accepted
    Time:52 ms
    Memory:11964 kb
****************************************************************/
 
#include <bits/stdc++.h>
 
typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ldb;
 
using namespace std;
 
#define nullptr NULL // for some oj not supporting c++11.
 
int getint(int x=0)
{
    char c=getchar(); bool mi = false;
    while(c!='-' && (c<'0' || '9'<c)) c=getchar();
    if(c=='-') { mi=true; c=getchar(); }
    x=c-'0';
    while('0'<=(c=getchar()) && c<='9') x=x*10+c-'0';
    return mi ? -x : x;
}
db getdb(db x=0.0) { scanf("%lf",&x); return x; }
 
//========================================
 
const int mxn = 1050;
const int mxm = 105000;
int INF=(1<<30)-1;
 
struct edge
{
    int in;
    int c;
    int v;
    edge*nxt;
    edge*ptr;
}pool[mxm]; edge*et=pool;
int orgv[mxm];
edge*eds[mxn];
void addedge(int i,int j,int c,int v)
{
    et->ptr=et+1; et->in=j; et->c=c; et->v= v; et->nxt=eds[i]; eds[i]=et++;
    et->ptr=et-1; et->in=i; et->c=0; et->v=-v; et->nxt=eds[j]; eds[j]=et++;
}
#define FOREACH_EDGE(i,j) for(edge*i=eds[j];i;i=i->nxt)
 
int n;
int cost;
 
int dist[mxn];
int st,ed;
bool used[mxn];
int DDFS(int x,int mi)
{
    if(x==ed) return mi;
    used[x]=true;
    int res=0,c;
    FOREACH_EDGE(i,x)
    if(i->c>0 && !used[i->in] && dist[x]+i->v==dist[i->in] && ( c=DDFS(i->in,min(i->c,mi)) ))
    {
        i->c -= c;
        i->ptr->c += c;
        res += c;
        mi -= c;
        cost += i->v*c;
        if(!mi) break;
    }
    if(!res) dist[x]=INF;
    used[x]=false;
    return res;
}
 
int q[mxm<<4];
int qh,qt;
int Dinic()
{
    int res=0;
    while(true)
    {
        for(int i=0;i<=n;i++) dist[i]=INF;
        qh=qt=0; q[qt++]=st;
        dist[st]=0;
        while(qh!=qt)
        {
            int x=q[qh++];
            FOREACH_EDGE(i,x)
            if(i->c>0 && dist[i->in]-dist[x]>i->v)
            {
                dist[i->in]=dist[x]+i->v;
                q[qt++]=i->in;
            }
        }
         
        if(dist[ed]==INF) break;
        res+=DDFS(st,INF);
    }
    return res;
}
 
int m,k;
 
edge*ote;
 
int cap[mxm];
int A[mxm];
int B[mxm];
int var[mxm];
int etot=0;
 
int main()
{
    n=getint()+1;
    m=getint();
    k=getint();
    st=1;
    ed=n-1;
    for(int i=0;i<m;i++)
    {
        int c;
        A[i]=getint();
        B[i]=getint();
        c=getint();
        orgv[i]=getint();
        addedge(A[i],B[i],c,1);
    }
     
    printf("%d ",Dinic());
     
    for(int i=1;i<n;i++)
    FOREACH_EDGE(e,i) e->v=0;
     
    cost=0;
     
    for(int i=0;i<m;i++)
    addedge(A[i],B[i],INF,orgv[i]);
     
    st=0;
    addedge(st,1,k,0);
    Dinic();
    printf("%d\n",cost);
     
    return 0;
}
